# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=gst-plugins-espeak
pkgver=0.5.0
pkgrel=4
pkgdesc="Use espeak as a sound source for gstreamer"
arch=('loong64' 'x86_64')
url="https://wiki.sugarlabs.org/go/Activity_Team/gst-plugins-espeak"
license=('LGPL')
depends=('gst-plugins-base-libs' 'espeak-ng')
source=("$pkgname-$pkgver.tar.gz::https://github.com/sugarlabs/gst-plugins-espeak/archive/refs/tags/v$pkgver.tar.gz"
        'fix-build.patch::https://github.com/sugarlabs/gst-plugins-espeak/commit/56a5a56a38cf460d9af4bef12327b39aef3bfa6e.patch'
        'remove-0sugar.patch::https://github.com/sugarlabs/gst-plugins-espeak/commit/8f4765fab81cccce834b75a69956c17547be9391.patch'
        'espeak-ng.patch::https://github.com/sugarlabs/gst-plugins-espeak/commit/643b4b11670198bcb73e2ccb523b2f3cfba639a0.patch'
        'fix-espeak-ng-include.patch::https://github.com/sugarlabs/gst-plugins-espeak/commit/7f6e41274fb833a487a7ee8ac0c236f0821330cc.patch')
sha256sums=('dbca65ae824d105d07b97e26a40a699b54989df21119e60cc12266727aa1b32b'
            'aea0d1df4753584925e864450bce2d6ce8a7f1d7108e164057140bc5d7bb63fc'
            '9ec323b67884b7a9a262e3b48c69f6f87493c24fea7d698711de3576d15a3213'
            'f143c400f387ecb71e81db9922232a08e4e11ebade45727334f2e28008fa3c5c'
            'a225ee7bac231916db8a0a3fa02609eab8f04b63a3dcc5cbd94c8c505c26b4a8')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../fix-build.patch
  patch -Np1 -i ../remove-0sugar.patch
  patch -Np1 -i ../espeak-ng.patch
  patch -Np1 -i ../fix-espeak-ng-include.patch
  autoreconf -fi
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
